package com.qkm.xinguan.controller;

import com.alipay.api.AlipayApiException;
import com.qkm.xinguan.domain.entity.Trade;
import com.qkm.xinguan.domain.transform.dto.NoticeDTO;
import com.qkm.xinguan.domain.transform.dto.TradeDTO;
import com.qkm.xinguan.response.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author zfj
 * @date 2021/12/27 -14:02
 * 支付
 */
@RequestMapping("/business/trade")
@Api(value = "支付订单管理模块", tags = "支付订单管理接口")
public interface ITradeController {

	@PostMapping("/show")
	@ApiOperation(value = "添加支付订单", notes = "支付订单添加")
	String qrCode(@RequestBody @Validated TradeDTO tradeDTO, BindingResult result) throws AlipayApiException;

	@GetMapping("/pay/{id}")
	@ApiOperation(value = "查询支付订单", notes = "支付订单查询")
	String PayCheck(@PathVariable String id) throws AlipayApiException;

	@PostMapping("/add")
	@ApiOperation(value = "添加支付订单", notes = "支付订单添加")
	Result addTrade(@RequestBody @Validated Trade trade, BindingResult result);

	@GetMapping("/list/{touristId}")
	@ApiOperation(value = "分页获取支付订单信息", notes = "分页获取支付订单")
	Result getTradePage(@PathVariable("touristId") Long touristId);

	@GetMapping("/list")
	@PreAuthorize("hasAuthority('trade:query')")
	@ApiOperation(value = "分页获取订单信息", notes = "分页获取订单")
	Result getTradeList(@RequestParam(value = "page", defaultValue = "1") Integer page,
	                    @RequestParam(value = "size", defaultValue = "5") Integer size);
}
